#!/usr/bin/env python
# coding: utf-8

# In[50]:


import requests 
import pandas as pd
import json


# In[ ]:


# 1.腾讯云--【语音翻译】
import json
from tencentcloud.common import credential
from tencentcloud.common.profile.client_profile import ClientProfile
from tencentcloud.common.profile.http_profile import HttpProfile
from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException
from tencentcloud.tmt.v20180321 import tmt_client, models
try: 
    cred = credential.Credential("AKIDnRvQlxzUebS8aowOjqhOWieJ5SbViLOC", "iFeqxoNjqiRGyWzTq9qX9bt1yDIRXTEo") 
    httpProfile = HttpProfile()
    httpProfile.endpoint = "tmt.tencentcloudapi.com"

    clientProfile = ClientProfile()
    clientProfile.httpProfile = httpProfile
    client = tmt_client.TmtClient(cred, "ap-guangzhou", clientProfile) 

    req = models.SpeechTranslateRequest()
    params = {
        "SessionUuid": "2",
        "Source": "en",
        "Target": "zh",
        "AudioFormat": 83886080,
        "Seq": 0,
        "IsEnd": 1,
        "Data": "//uUBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWGluZwAAAA8AAAE0AAGKgAAAAQIDBQcJCgwOEBITFBQVFhcXGBocHiEmKCstMTM2Oj1AQ0VJTE5SVVhcYGRoa21wc3d5fYKFiY6QlZean6Wqr7G1uby/xMjMz9LW2Nzh5ejr7vDx8/X39/j5+vr7/P39/v8AAAAoTEFNRTMuOTlyBKUAAAAAAAAAADUgJAPAhQABuAABioAR/3e2AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//sUBAAP8AAAaQAAAAgAAA0gAA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BPhHNYeYaMCfCOaw8w0YvrwsTf4VTIAAyciostLh2V"
    }
    req.from_json_string(json.dumps(params))

    resp = client.SpeechTranslate(req) 
    print(resp.to_json_string()) 

except TencentCloudSDKException as err: 
    print(err) 


# 输出
# ```python
# {
#   "Response": {
#     "RequestId": "550ef21e-5f4a-40ce-8473-6626596d44a9",
#     "SessionUuid": "2",
#     "RecognizeStatus": 1,
#     "SourceText": "",
#     "TargetText": "",
#     "Seq": 0,
#     "Source": "en",
#     "Target": "zh",
#     "VadSeq": 0
#   }
# }
# ```

# In[ ]:


# 2.腾讯云--【语种识别】
import json
from tencentcloud.common import credential
from tencentcloud.common.profile.client_profile import ClientProfile
from tencentcloud.common.profile.http_profile import HttpProfile
from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException
from tencentcloud.tmt.v20180321 import tmt_client, models
try: 
    cred = credential.Credential("AKIDnRvQlxzUebS8aowOjqhOWieJ5SbViLOC", "iFeqxoNjqiRGyWzTq9qX9bt1yDIRXTEo") 
    httpProfile = HttpProfile()
    httpProfile.endpoint = "tmt.tencentcloudapi.com"

    clientProfile = ClientProfile()
    clientProfile.httpProfile = httpProfile
    client = tmt_client.TmtClient(cred, "ap-guangzhou", clientProfile) 

    req = models.LanguageDetectRequest()
    params = {
        "Text": "I love you",
        "ProjectId": 0
    }
    req.from_json_string(json.dumps(params))

    resp = client.LanguageDetect(req) 
    print(resp.to_json_string()) 

except TencentCloudSDKException as err: 
    print(err) 


# 输出
# ```python
# {
#   "Response": {
#     "RequestId": "6100a9fe-b34a-4b83-b5f2-5351ac58520a",
#     "Lang": "en"
#   }
# }
# ```

# In[51]:


# 获取access_token等参数信息
# encoding:utf-8
# client_id 为官网获取的AK， client_secret 为官网获取的SK
host = 'https://aip.baidubce.com/oauth/2.0/token?'
params = {
    "grant_type":"client_credentials",
    "client_id":"Tz9rZCmKK8HAr07pko5ZO7nM",
    "client_secret":"5fc1lXruhEnZ0MEHI4l5nPG110QuWxcm"
}
response = requests.get(host,params=params)
display(pd.json_normalize(response.json()).T)

access_token=response.json()["access_token"]
access_token


# In[52]:


# 3.百度智能云--【依存句法分析】
def grammer(text):
    url = "https://aip.baidubce.com/rpc/2.0/nlp/v1/depparser?access_token="+access_token
    data = {
        "text": text
    }
    encode_data=json.dumps(data).encode('UTF-8')
    headers = {
        "content-type": "application/json"
    }
    return requests.post(url, data=encode_data, headers=headers).json()

grammer("今天的天气很好")


# In[54]:


# 4.百度智能云--【DNN语言模型】
def dnn(text):
    url = "https://aip.baidubce.com/rpc/2.0/nlp/v2/dnnlm_cn?access_token="+access_token
    data = {
        "text" : text   
    }
    encode_data=json.dumps(data).encode('UTF-8')
    headers = {
        'Content-Type':'application/json'
    }
    return requests.post(url,headers=headers,data=encode_data).json()

dnn("床前明月光")


# In[58]:


# 5.百度智能云--【文本纠错】 
def correct(text):
    url = "https://aip.baidubce.com/rpc/2.0/nlp/v1/ecnet?access_token="+access_token
    data = {
        "text" : text   
    }
    encode_data=json.dumps(data).encode('UTF-8')
    headers = {
        'Content-Type':'application/json'
    }
    return requests.post(url,headers=headers,data=encode_data).json()

correct("百度是一家人工只能公司")

